Config File
The config file, named config.lua
contains the most basic configuration options.
Zones configuration
...
cameras = {
pacific = {
label = "Pacific Standard",
managementOverride = "Law Enforcement Agencies",
management = {
{
label = "Police",
job = "police",
identifiers = {
["steam:100000000"] = true -- Fake identifier, just for demonstration (only steam identifiers allowed)
},
permissions = { -- Set to nil if you don't want advanced permissions for this job
view = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
if FxCfg.options.useFramework == "ESX" then
return true
else
return true
end
end,
repair = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
if FxCfg.options.useFramework == "ESX" then
return true
else
return true
end
end,
create = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
print("JD", json.encode(jobData))
if FxCfg.options.useFramework == "ESX" then
return jobData.grade > 3
else
return jobData.grade.level > 3
end
end,
delete = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
if FxCfg.options.useFramework == "ESX" then
return jobData.grade > 3
else
return jobData.grade.level > 3
end
end,
}
}
},
cams = {},
repairCams = vector3(263.1777, 211.5018, 110.2872)
}
}
...
The shown code illustrates an example of a working configuration.
The configuration parameters mean the following:
- label : The shown name of the zone on the tablet and the placement configurator.
- managementOverride : When set, the tablet management section shows its value (by default, a string with the management jobs separated by comas is shown).
- management : The authorized jobs for the zone. Each job must have a label and a job parameter, where the job is the framework job id.
- cams : A set of pre-existing cameras can be shown from the beginning. Each camera is an object with a label, a coords (as a vector3) and a heading parameter. We suggest using in-game placement as this was a really old feature.
- repairCams : Describes the position of the 3d marker that is used to trigger the cam repairing.
To create a zone, simply copy and paste the default displayed zone ("pacific") and add a coma after the existing one. Then change the name of the zone to avoid duplicates and edit it accordingly to your needs.
Example of a multi-zone config:
...
cameras = {
pacific = {
label = "Pacific Standard",
managementOverride = "Law Enforcement Agencies",
management = {
{
label = "Police",
job = "police"
}
},
cams = {},
repairCams = vector3(263.1777, 211.5018, 110.2872)
},
zone2 = {
label = "Another zone",
managementOverride = "Another job",
management = {
{
label = "Medics",
job = "ambulance"
}
},
cams = {},
repairCams = vector3(112.6789, 111.1058, 100.0562)
},
}
...
The highlighted lines must be different between zones in order for the script to work properly
Advanced permissions
Advanced permissions is the latest introduced feature in the product. It allows to split the different actions into different permissions, so that you can have a job that can only create cameras, but not delete them, or have certain people of that job authorized only for some of the possible actions.
You can define the permissions for each job in the management object, as shown in the following example:
...
management = {
{
label = "LSPD",
job = "police",
permissions = {
view = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
if FxCfg.options.useFramework == "ESX" then
return true
else
return true
end
end,
repair = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
if FxCfg.options.useFramework == "ESX" then
return true
else
return true
end
end,
create = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
if FxCfg.options.useFramework == "ESX" then
return jobData.grade > 3
else
return jobData.grade.level > 3
end
end,
delete = function(jobData) -- [[ QB: jobData.grade.level, jobData.grade.name, ESX: jobData.grade, jobData.grade_name ]]
if FxCfg.options.useFramework == "ESX" then
return jobData.grade > 3
else
return jobData.grade.level > 3
end
end,
}
}
}
...
The previous configuration is defaulted to have everyone able to view and repair cameras, you may need to adjust it to your own needs
To avoid using advanced permissions, you may set permissions = nil
Using identifiers with Advanced Permissions
Using identifiers with advanced permissions may seem tricky. The functions to check the permissions do not provide directly the identifiers data. However, you may use Fx.vars.identifers to access the player identifiers client-side.
Generic Options
Database or JSON?
The script can use either a database or a json file to store the cameras. We recommend switching to the new database system (more about it here: TODO) as it avoids file permissions and compatibility problems. However, if you don't want to download oxmysql or prefer using the old system, you can set useDatabase to false.
...
options = {
useFramework = "ESX", -- available: ESX,QB
esxEvent = "esx:getSharedObject",
useDatabase = true, -- Decides wheter to use the old json system or the database update
debug = true,
drawDistance = 5.0,
drawSleep = 50, -- Higher : more optimized, blips lag; Lower : less optimized, blips are fluid
timeToFixCams = 60 * 1000 * 10, -- Ms that take for cameras to be fixed
itemtoView = "tablet", -- Item name (ESX/QB only) that if used opens the cameras menu
cameraItem = "security_camera", -- Camera item (ESX/QB only) that can be placed via an in game menu,
mountControls = {
up = 172, -- you can find all of the controls here : https://docs.fivem.net/docs/game-references/controls/
down = 173,
left = 174,
right = 175,
rleft = 20,
rright = 26
},
ui = {
menuLogo = "https://www.rapidalarms.com.au/wp-content/uploads/2019/06/dome-cctv-camera.jpg",
menuText = "Los Santos CCTV"
}
}
...
Many settings in the options object are pretty much self-explanatory or explained by comments.
The mount controls
Deprecated, the script now uses the UI to move the camera.